package com.it.selfAfter.entity.base;

public enum ErrorCode {

    // System error
    INTERNAL_SERVER_ERROR("500", "Internal Server Error"),
    BAD_REQUEST("400", "Bad request"),
    NOT_FOUND("404", "Page not found"),
    UNAUTHORIZED("401", "Unauthorized"),
    FORBIDDEN("403", "无权访问"),
    // member
    MEMBER_NOT_FOUND("9000", "用户不存在"),
    // login
    LOGIN_FAILURE("9001", "用户名或密码错误"),
    // logout
    LOGOUT_FAILURE("9002", "用户退出异常"),
    OLD_PASSWORD_INCORRECT("9003", "原密码不正确"),
    TOKEN_ERROR("9004", "TOKEN错误"),
    USER_DISABLE("9005", "用户已被禁用"),
    NOT_LOGIN("9006", "未登录"),
    OTHER_LOGIN("9007", "已在其他地方登陆"),
    LOGIN_TIME_OUT("9008", "账号长时间未登录，请联系管理员重置！"),
    USER_NOT_VISIBLE("9009", "账号密码有效期已超时，请联系管理员续期！"),
    PASSWORD_NOT_VISIBLE("9010", "账号已到期，请联系管理员续期！"),
    // register
    REGIST_PARAM_ERROR("9101", "请求参数有误"),
    REGIST_VERIFY_ERROR("9102", "图片验证码不正确"),
    REGIST_DYNAMIC_ERROR("9103", "动态验证码不正确"),
    REGIST_MOBILE_EXIST("9104", "手机号已注册"),
    REGIST_USERNAME_EXIST("9110", "用户名已注册"),
    DATA_EXIST("9111", "数据重复添加"),
    REGIST_FAILURE("9105", "用户注册失败"),
    // account
    ACCOUNT_NOT_FOUND("9201", "获取账户信息失败"),
    //app端过期异常码
    TOKEN_OVERDUE("9202", "token过期"),
    //user手机端登录
    SIGN_FOR_HOME_TOKEN_OVERDUE("9203", "token过期"),
    // 忘记密码
    FORGET_NOT_FOUND("9301", "该手机号尚未注册"),
    FORGET_NOT_MATCH("9302", "短信验证码不正确"),
    FORGET_UNAUTHORIZED("9303", "该手机号未经验证"),
    FORGET_RESET_FAILED("9304", "登录密码重置失败"),
    PASSWORD_MODIFY_FAILED("9305", "登录密码修改失败"),
    // sms
    SMS_DAILY_LIMIT("9901", "今日短信发送已达上限"),
    INVALID_CODE("40029", "invalid code"),


    PARAM_ERROR("2001", "参数校验失败");

    private String errorCode;
    private String message;

    ErrorCode(String errorCode, String message) {
        this.errorCode = errorCode;
        this.message = message;
    }

    public String getErrorCode() {
        return this.errorCode;
    }

    public String getMessage() {
        return this.message;
    }

    public ErrorCode setMessage(String message) {
        this.message = message;
        return this;
    }

    @Override
    public String toString() {
        return this.errorCode;
    }

}
